home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-07-16 | 1.3 KB | 52 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CCrossMemory.cp ©1996-97 Timo Eloranta All rights reserved.
- // ===========================================================================
- // This class, used by CGraphDrawing, was added to the application in the
- // optimization phase to speed up the process of calculating edge crossings.
-
- #include "CCrossMemory.h"
-
- #include <UException.h>
-
- // ---------------------------------------------------------------------------
- // • CCrossMemory
- //
- // Called by: CGraphDrawing::AddCrossMemory
- // ---------------------------------------------------------------------------
- // Constructor.
-
- CCrossMemory::CCrossMemory( UInt16 inEdgeCount )
- {
- mEdgeCount = inEdgeCount;
- mCrossTotal = 0;
-
- mSize = (mEdgeCount * ( mEdgeCount - 1 )) / 2;
- mByteSize = mSize * sizeof(Boolean);
-
- mArray = nil;
-
- #if __POWERPC__
- mArray = new Boolean[ mSize ];
- #else // 68K
- if ( mByteSize < 32768 )
- mArray = new Boolean[ mSize ];
- #endif
-
- ThrowIfNil_ (mArray);
- }
-
- // ---------------------------------------------------------------------------
- // • ~CCrossMemory
- //
- // Called by: CGraphDrawing::JunkCrossMemory
- // ---------------------------------------------------------------------------
- // Destructor.
-
- CCrossMemory::~CCrossMemory()
- {
- if ( mArray ) {
- delete [] mArray;
- mArray = nil;
- }
- }
-